package com.myj.jim.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.myj.jim.dao.MenuDao;
import com.myj.jim.domain.Menu;
import com.myj.jim.service.MenuService;

@Service
public class MenuServiceImpl implements MenuService {

	@Autowired
	private MenuDao menuDao;
	
	@Override
	public List<Menu> getMenuList() {
		List<Menu> pmList = menuDao.selectListByPid(0);
		
		for(Menu pm : pmList){
			List<Menu> cmList = menuDao.selectListByPid(pm.getId());
			pm.setChildren(cmList);
		}
		return pmList;
	}

}
